package com.jeecg.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jeecg.entity.User;
import com.jeecg.service.UserService;


@Controller("userController")
@RequestMapping("/user")
public class UserController {
	
	@Autowired
	@Qualifier("userService")
	private UserService userService;
	
	
	@RequestMapping(value="/addUser")
	public String addUser(User user) {
		userService.addUser(user);
		return "success";
	}
	
	@RequestMapping(value="/query")
	public String query(HttpServletRequest request) {
		List<User> list = userService.findAll();
		request.setAttribute("list",list);
		return "userList";
	}
}
